
<div style="margin-bottom:20px;">
    
    <form action="<?php echo $this->Html->url(array('action' => 'index')); ?>" method="POST" id="filter_index">
    
    <h4><?php __('City'); ?>:
        <select onchange="document.getElementById('select_branch_id').value = 0;document.getElementById('filter_index').submit()" name="filter_city_id">
            <?php foreach($cities as $c ) {
                $selected = "";
                if($c["City"]["id"] == $city_id)
                {
                    $selected = 'selected="selected"';
                }
            ?>
                <option value="<?php echo $c["City"]["id"] ?>" <?php echo $selected; ?> ><?php echo $c["City"]["name"] ?></option>
            <?php } ?>
        </select>
    </h4>
    <h4><?php __('Branch'); ?>:
        <select onchange="document.getElementById('filter_index').submit()" name="filter_branch_id" id="select_branch_id">
            <option value="0">All Branches</option>
            <?php foreach($branches as $c ) {
                $selected = "";
                if($c["Branch"]["id"] == $branch_id)
                {
                    $selected = 'selected="selected"';
                }
            ?>
                <option value="<?php echo $c["Branch"]["id"] ?>" <?php echo $selected; ?> ><?php echo $c["Branch"]["name"] ?></option>
            <?php } ?>
        </select>
    </h4>
    <h4><?php __('Year'); ?>:
        <select onchange="document.getElementById('filter_index').submit()" name="filter_year">        
            <?php for($i=1991; $i < 2031; $i++ ) {
                $selected = "";
                if($year == $i)
                {
                    $selected = 'selected="selected"';
                }
            ?>
                <option value="<?php echo $i ?>" <?php echo $selected; ?> ><?php echo $i ?></option>
            <?php } ?>
        </select>
    </h4>
    </form>
    
</div>

